#include "mysig.h"

void (*signal(int, void (*) (int))) (int);

static int times = 0;
static void my_handler(int);

int main() {
    signal(SIGCHLD, my_handler);
    while (1) {
        pause();
        printf("haha\n");
    }
    return 0;
}

static void my_handler(int sig) {
    if (times++ == 10) {
        exit(EXIT_FAILURE);
    }
    printf("receve signal %d for %d times\n", sig, times);
}
